
export const initState={
    // 初始化user
    user: {
        phone: "",
        nickname: "",
        password: ""
    },
}

export const reducer=(state,action)=>{
    switch(action.type){
        case "changeUser":
            return {
                ...state,
                user:{
                    ...state.user,
                    [action.key]:action.value
                }
            }
        default:
            return state;
    }
}

export const actions={
    // 修改user的action
    changeUser:(key,value)=>({type:"changeUser",key,value}),
    
}